home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / lang / eiffel / smalleif.97 / se.t / SmallEiffel / lib_test / try_print_on.e < prev    next >
Encoding:
Text File  |  1996-05-02  |  1.7 KB  |  79 lines

  1. -- Part of SmallEiffel -- Read DISCLAIMER file -- Copyright (C) 
  2. -- Dominique COLNET and Suzanne COLLIN -- colnet@loria.fr
  3. --
  4. class TRY_PRINT_ON
  5.  
  6. creation {ANY}
  7.    make, full_test
  8.    
  9. feature {ANY}
  10.    
  11.    cat: CAT;
  12.    
  13.    point: POINT;
  14.    
  15.    triangle: TRIANGLE;
  16.    
  17.    make is
  18.       do
  19.      std_output.put_string("a INTEGER: ");
  20.      (1).print_on(std_output);
  21.      std_output.put_new_line;
  22.      
  23.      std_output.put_string("a REAL: ");
  24.      (1.5).print_on(std_output);
  25.      std_output.put_new_line;
  26.      
  27.      std_output.put_string("a STRING: ");
  28.      ("foo :-)").print_on(std_output);
  29.      std_output.put_new_line;
  30.       end;
  31.    
  32.    full_test is
  33.      -- Separated because it prints memory address and 
  34.      -- cause problems with SmallEiffel/misc/self_test.good_output
  35.       do
  36.      !!cat;
  37.      std_output.put_string("a CAT: ");
  38.      cat.print_on(std_output);
  39.      std_output.put_new_line;
  40.      
  41.      !!point.make(1,2);
  42.      std_output.put_string("a POINT: ");
  43.      point.print_on(std_output);
  44.      std_output.put_new_line;
  45.      
  46.      !!triangle.make(point,point,clone(point));
  47.      std_output.put_string("a TRIANGLE: ");
  48.      triangle.print_on(std_output);
  49.      std_output.put_new_line;
  50.      
  51.      std_output.put_string("an ARRAY: ");
  52.      (<<'a','b','c'>>).print_on(std_output);
  53.      std_output.put_new_line;
  54.      
  55.      std_output.put_string("an ARRAY: ");
  56.      (<<1,2,3>>).print_on(std_output);
  57.      std_output.put_new_line;
  58.      
  59.      std_output.put_string("an ARRAY: ");
  60.      (<<"a","b","c">>).print_on(std_output);
  61.      std_output.put_new_line;
  62.       end;
  63.    
  64.    is_true(b: BOOLEAN) is
  65.       do
  66.      cpt := cpt + 1;
  67.      if not b then
  68.         std_output.put_string("TRY_PRINT_ON: ERROR Test # ");
  69.         std_output.put_integer(cpt);
  70.         std_output.put_string("%N");
  71.      else
  72.         std_output.put_string("Yes %N");
  73.      end;
  74.       end;
  75.    
  76.    cpt: INTEGER;
  77.    
  78. end -- TRY_PRINT_ON
  79.